home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Delphi Magazine Collection 2001
/
Delphi Magazine Collection 20001 (2001).iso
/
DISKS
/
Issue38
/
Clinic
/
NoClose2Form.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1998-06-24
|
755b
|
36 lines
unit NoClose2Form;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
private
procedure WMQueryEndSession(var Msg: TWMQueryEndSession);
message wm_QueryEndSession;
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.WMQueryEndSession(var Msg: TWMQueryEndSession);
const
Prompt = 'Allow program to close, and thereby let Windows session end?';
begin
LongBool(Msg.Result) :=
MessageDlg(Prompt, mtConfirmation, [mbYes, mbNo], 0) = mrYes;
//If it still seems okay to terminate, then call previously installed checking
if LongBool(Msg.Result) then
inherited;
end;
end.